<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .box {
        /* padding: auto;
        margin: auto;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0; */
        /* position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%); */

        justify-self: center;
        align-self: center;
        width: 0;
        height: 0;
        border: 40px solid transparent;
        border-bottom: 40px solid brown;
      }
    </style>
  </head>
  <body>
    <div class="box"></div>
    <script>
      /*     setTimeout(() => {
            console.log(1)
          }, 0) // 宏任务2

          new Promise((resolve, reject) => {
            console.log(2) // 1 宏任务1
            resolve('p1')

            new Promise((resolve, reject) => {
              console.log(3) // 2 宏任务1
              setTimeout(() => {
                //宏任务3
                resolve('setTimeout2')
                console.log(4)
              }, 0)
              resolve('p2')
            }).then((data) => {
              // 微任务1
              console.log(data)
            })

            setTimeout(() => {
              //宏任务4
              resolve('setTimeout1')
              console.log(5)
            }, 0)
          }).then((data) => {
            // 微任务2
            console.log(data)
          })

          console.log(6) // 3 宏任务1 */

      // console.log(Object.prototype.toString.call({})) // [object Object]
      // console.log(Object.prototype.toString.call(/^i$/)), //[object RegExp]
      //   console.log(Object.prototype.toString.call([])), // [object Array]
      //   console.log(Object.prototype.toString.call(true)), //[object Boolean]
      //   console.log(Object.prototype.toString.call(() => {})) //[object Function]
      // console.log(Array.isArray([])) //true

      // var a = 1
      // function update() {
      //   console.log(a)  //un
      //   var a = 2
      //   console.log(a) // 2
      // }
      // console.log(a)  //1
      // update()
      // console.log(a) //1

      // const p = new Promise((resolve, reject) => {
      //   console.log(1)
      //   console.log(2)
      // })
      // p.then(() => {
      //   console.log(3)
      // })
      // console.log(4)

      // const p = new Promise((resolve, reject) => {
      //   resolve('suss1')
      //   reject('err')
      //   resolve('suss2')
      // })
      // p.then((res) => {
      //   console.log('then',res)
      // }).catch((res) => {
      //   'ca', res
      // })
    </script>
  </body>
</html>
